<template>
    <div class="newsInfo_box">
        <h3>{{ info.title }}</h3>
        <p class="infoItem">
            <span>创建时间：{{ info.add_time | timeF }}</span>
            <span>点击：{{ info.click }}次</span>
        </p>
        <hr>
        <div class="infoContent" v-html="info.content"></div>
        <comment-box :infoId='this.id'></comment-box>
    </div>
</template>
<script>
// 导入评论模块
import comment from '../comment/connent.vue'
export default {
    data(){
        return{
            id: this.$route.params.id,
            info:{}
        }
    },
    created(){
       this.getNewsInfo()
    },
    methods:{
        getNewsInfo(){
            this.$http.get('api/getnew/' + this.id).then(function(result){
                if (result.body.status == 0){
                    this.info = result.body.message[0]
                }
            })
        }
    },
    components:{
        "comment-box":comment
    }
}
</script>

<style lang="scss">
.newsInfo_box {
    padding: 0 5px;
    h3 {
        font-size: 18px;
        color:yellow;
        text-align: center;
        padding: 5px 0;
    }
    .infoItem {
            color: aqua;
            font-size: 12px;
            display: flex;
            justify-content: space-between;
        }
}
</style>
